<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form  action="<?php echo url_for('@sf_guard_register') ?>" method="post">
  <table>
    <tr>
      <th>
        <label for="sf_guard_user_username"><?php echo __('My name') ?></label>
      </th>
      <td>
        <?php echo $form['first_name']->render(array('class' => 'default_field_text capitalize', 'default' => __('First name'), 'title' => __('First name'))) ?>
      </td>
      <td>
        <?php echo $form['last_name']->render(array('class' => 'default_field_text capitalize', 'default' => __('Last name'), 'title' => __('Last name'))) ?>
        <?php if ($form['first_name']->hasError() && $form['last_name']->hasError()): ?>
            <?php echo $form['first_name']->renderError() ?>
        <?php elseif ($form['first_name']->hasError() XOR $form['last_name']->hasError()):?>
            <?php echo $form['first_name']->renderError() ?>
            <?php echo $form['last_name']->renderError() ?>
        <?php endif ?>
      </td>
    </tr>
    <?php foreach ($form as $name => $field): ?>
      <?php if (!$field->isHidden()) : ?>
        <?php if ($name == 'first_name' || $name == 'last_name') : ?>
          <?php continue ?>
        <?php endif ?>
        <tr>
          <th>
            <?php echo $field->renderLabel() ?>
          </th>
          <td>
            <?php echo $field->render(array('class' => 'default_field_text')) ?>
          </td>
          <?php if ($field->hasError()): ?>
            <td>
              <?php echo $field->renderError() ?>
            </td>
          <?php endif ?>
        </tr>
      <?php else : ?>
        <?php echo $field->render() ?>
      <?php endif ?>
    <?php endforeach ?>
    
    <tfoot>
      <tr>
        <td colspan="2">
          <input type="submit" name="register" value="<?php echo __('Register') ?>" />
        </td>
      </tr>
    </tfoot>
  </table>
</form>